import os


class EnvConfig:

    ENV_MAP = {
        "qiming-test": {
            "local": "http://nginx.qiming-test.dq.yingmi-inc.com",
            "k8s": "http://nginx.qiming-test",
            "db_ip": "dev-qiming-db-e01.int.frontnode.net",
            "db_port": "5503",
            "db_user": "ying99_testing",
            "db_password": "ying99_testing"
        },
        "qiming-test2": {
            "local": "http://nginx.qiming-test2.dq.yingmi-inc.com",
            "k8s": "http://nginx.qiming-test2",
            "db_ip": "dev-qiming-db-e01.int.frontnode.net",
            "db_port": "5503",
            "db_user": "ying99_testing",
            "db_password": "ying99_testing"
        },
        "qiming-test3": {
            "local": "http://nginx.qiming-test3.dq.yingmi-inc.com",
            "k8s": "http://nginx.qiming-test3",
            "db_ip": "dev-qiming-db-e01.int.frontnode.net",
            "db_port": "5503",
            "db_user": "ying99_testing",
            "db_password": "ying99_testing"
        }
    }
    DEFAULT_ENV = "qiming-test3"

    def __init__(self):
        if os.environ.get('env') is None:
            os.environ['env'] = self.DEFAULT_ENV
        if os.environ.get('deploy') is None:
            os.environ['deploy'] = "local"

        self.env = os.environ.get('env')
        self.deploy = os.environ.get('deploy')
        self.base_url = self.ENV_MAP[self.env][self.deploy]
        self.tdp_url = self.ENV_MAP["qiming"][self.deploy]


env_config = EnvConfig()
